<?php
/**
 * KePHP, Keep PHP easy!
 */

namespace CSService\Model\Server;

use Ke\Adm\Model;

/**
 * Class Server
 * tableName server
 *
 * // class properties
 * @property int    $id          id
 * @property string $name        名称
 * @property string $lan_ip      局域网ip
 * @property string $external_ip 外部ip
 * @property int    $position    排序
 * @property int    $status      状态
 * // class properties
 */
class Server extends Model
{

	protected static $pk = 'id';

	protected static $pkAutoInc = true;

	protected static $columns = [
		'name'        => ['edit' => 'text'],
		'position'    => ['edit' => 'number', 'default' => 0],
		'lan_ip'      => ['edit' => 'text', 'require' => 1, 'unique' => 1],
		'external_ip' => ['edit' => 'text',],
		'status'      => ['edit' => 'radio', 'options' => [1 => '启用', 0 => '停用']],
	];

	public static function dbColumns()
	{
		// database columns
		// generated as 2016-02-01 22:52:19
		return [
			'id'          => ['int' => 1, 'pk' => 1, 'autoInc' => 1],
			'name'        => ['label' => '名称', 'max' => 16],
			'lan_ip'      => ['label' => '局域网ip', 'max' => 16],
			'external_ip' => ['label' => '外部ip', 'max' => 16],
			'position'    => ['label' => '排序', 'int' => 1, 'default' => 0],
			'status'      => ['label' => '状态', 'int' => 1, 'default' => 0],
		];
		// database columns
	}

}
